PROJECT("EAP Methods Plugins" C)

MACRO(EAP_ADD_METHOD METHNAME)
  ADD_LIBRARY(${METHNAME} MODULE ${ARGN})
  SET_TARGET_PROPERTIES(${METHNAME} PROPERTIES PREFIX "" )
  SET_TARGET_PROPERTIES(${METHNAME} PROPERTIES SUFFIX ".emp" )
  INSTALL(TARGETS ${METHNAME}
	LIBRARY DESTINATION ${INSTALL_EXTENSIONS_SUFFIX}
	COMPONENT freeDiameter-eap-server)
ENDMACRO(EAP_ADD_METHOD)

# Use the macro FD_EAP_PLUGIN(extmacroname subdir descr default) to 
# add a new extension subdirectory.
MACRO(FD_EAP_PLUGIN EXTSUBDIR EXTDESCR EXTDEFAULT)
   STRING(TOUPPER ${EXTSUBDIR} EXTMACRONAME)
   IF (NOT ALL_EXTENSIONS)
     OPTION(BUILD_${EXTMACRONAME} ${EXTDESCR} ${EXTDEFAULT})
   ENDIF (NOT ALL_EXTENSIONS)
   IF (BUILD_${EXTMACRONAME} OR ALL_EXTENSIONS)
      ADD_SUBDIRECTORY(${EXTSUBDIR})
   ENDIF (BUILD_${EXTMACRONAME} OR ALL_EXTENSIONS)
ENDMACRO(FD_EAP_PLUGIN)

###########################
# EAP Methods Plugins Section

# EAP Identity plugin
FD_EAP_PLUGIN(eap_identity "Build EAP Identity Plugin " ON)

# EAP MD5 plugin
FD_EAP_PLUGIN(eap_md5 "Build EAP-MD5 Plugin " OFF)

# EAP TLS plugin
FD_EAP_PLUGIN(eap_tls "Build EAP-TLS Plugin " OFF)
